package com.thrd.taiexhibition.adapter;

import android.content.Context;
import android.text.TextUtils;
import android.widget.TextView;

import com.thrd.basicframework.bean.BaseRecyclerAdapter;
import com.thrd.taiexhibition.R;
import com.thrd.taiexhibition.bean.BeanCityInvest;
import com.thrd.taiexhibition.bean.BeanCityInvestArticle;
import com.thrd.taiexhibition.ui.InvestmentItem;

import java.util.List;

/**
 * @author: ${唐杰}
 * @date: 2021/4/16
 */
public class InvestmentHorizontalAdapter extends BaseRecyclerAdapter<BeanCityInvest> {
    public InvestmentHorizontalAdapter(Context context, List data) {
        super(context, data);
    }


    @Override
    public void bindData(BaseViewHolder holder, BeanCityInvest beanCityInvest) {
        TextView mTextView = (TextView) holder.getView(R.id.tv_title);
        InvestmentItem mInvestmentItem= (InvestmentItem) holder.getView(R.id.ii_investment);
        mInvestmentItem.setOnClickItemListener(new InvestmentItem.OnClickItemListener() {
            @Override
            public void onClickItemListener(BeanCityInvestArticle t) {
                if(onItemInvestmentItem!=null){
                    onItemInvestmentItem.onItemInvestmentItem(t);
                }
            }
        });
        mTextView.setText(TextUtils.isEmpty(beanCityInvest.getInvestTypeName())?"":beanCityInvest.getInvestTypeName());
        mInvestmentItem.setBeanCityIndustry(beanCityInvest.getInvestTypeArticleList());
    }

    @Override
    public int getItemLayoutId() {
        return R.layout.item_investment_horizontal;
    }

    private OnItemInvestmentItem onItemInvestmentItem;

    public OnItemInvestmentItem getOnItemInvestmentItem() {
        return onItemInvestmentItem;
    }

    public void setOnItemInvestmentItem(OnItemInvestmentItem onItemInvestmentItem) {
        this.onItemInvestmentItem = onItemInvestmentItem;
    }

    public interface OnItemInvestmentItem{
        void onItemInvestmentItem(BeanCityInvestArticle mBeanCityInvestArticle);
    }


}
